package com.mrdeer.iot.dto;

import com.mrdeer.common.base.Converter;
import com.mrdeer.common.entity.beans.PageEntity;
import com.mrdeer.iot.entity.DeviceEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

/**
 * @Author: xie jianchu
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class DeviceEntityDTO extends DeviceEntity implements Converter<DeviceEntity, DeviceEntityDTO> {

    private boolean online;

    private PageEntity page;

    @Override
    public void convert2Do(DeviceEntity device) {
        BeanUtils.copyProperties(device, this);
    }

    @Override
    public DeviceEntityDTO convert(DeviceEntity device) {
        BeanUtils.copyProperties(this, device);
        return this;
    }
}
